import java.util.Scanner;
public class 面积 {
    //定义三个无参数无返回值方法，分别实现计算三角形、正方形、长方形的面积。
    public static void sanjiaoxing1() {
        Scanner scanner = new Scanner(System.in);
        System.out.println("输入三角形的底");
        double a = scanner.nextDouble();
        System.out.println("输入三角形的高");
        double h = scanner.nextDouble();
        double s = a * h / 2;
        System.out.println(s);
    }

    public static void changfangxing1() {
        Scanner scanner = new Scanner(System.in);
        System.out.println("输入长方形的宽");
        double a = scanner.nextDouble();
        System.out.println("输入长方形的长");
        double c = scanner.nextDouble();
        double s = a * c;
        System.out.println(s);
    }

    public static void zhengfangxing1() {
        Scanner scanner = new Scanner(System.in);
        System.out.println("输入正方形的边长");
        double a = scanner.nextDouble();
        double s = a * a;
        System.out.println(s);
    }

    //        定义三个有参数无返回值方法，分别实现计算三角形、正方形、长方形的面积。
    public static void sanjiaoxing2(double a, double b) {
        double result = a * b / 2;
        System.out.println(result);
    }

    public static void changfangxing2(double a, double b) {
        double result = a * b;
        System.out.println(result);
    }

    public static void zhengfangxing2(double a) {
        double result = a * a;
        System.out.println(result);
    }

    //        定义三个有参数有返回值方法，分别实现计算三角形、正方形、长方形的面积。
    public static double sanjiaoxing3(double a, double b) {
        double result = a * b / 2;
        return result;
    }
    public static double changfangxing3(double a, double b) {
        double result = a * b;
        return result;
    }
    public static double zhengfangxing3(double a) {
        double result = a * a;
        return result;
    }
}
